import type { RouteRecordRaw } from 'vue-router';

import { PageEnum } from '/@/enums/pageEnum';

const modules = import.meta.globEager('./modules/**/*.ts');

const routeModuleList: RouteRecordRaw[] = [];

Object.keys(modules).forEach((key) => {
  const mod = modules[key].default || {};
  const modList = Array.isArray(mod) ? [...mod] : [mod];
  routeModuleList.push(...modList);
});

export const matchRoute: RouteRecordRaw = {
  path: '/:pathMatch(.*)',
  redirect: PageEnum.BASE_HOME
};

// Basic routing without permission
export const basicRoutes = [...routeModuleList, matchRoute];
console.log(basicRoutes)
